# 裁剪一个pdf文件的指定页数 25609
import pypdf
import sys
pages = sys.argv[1].split(',')
pages = [int(i)-1 for i in pages]
input_pdf = pypdf.PdfReader(open('origin.pdf', 'rb'))
output_pdf = pypdf.PdfWriter()
print(pages)
for i in pages:
    if i < len(input_pdf.pages):
        output_pdf.add_page(input_pdf.pages[i])
with open('output.pdf', 'wb') as output_file:
    output_pdf.write(output_file)
